home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / fmodla13.zip / SYSTEM.DEF < prev    next >
Text File  |  1992-01-29  |  5KB  |  160 lines

  1. DEFINITION MODULE System;
  2.  
  3. (* (C) Copyright 1987 Fitted Software Tools. All rights reserved. *)
  4.  
  5. (*
  6.     This module contains definitions that are SYSTEM DEPENDENT.
  7.     This version is for the IBM PC running DOS >= 2.0.
  8. *)
  9.  
  10. FROM SYSTEM IMPORT  WORD, ADDRESS;
  11.  
  12.  
  13. (*** FOR EXCLUSIVE USE OF M2LINK. DO NOT TOUCH! ***)
  14. VAR
  15.     Main, ProfStart, ProfEnd    :PROC;
  16.  
  17.  
  18. (*** START OF EXPORTED STUFF: ***)
  19.  
  20. TYPE
  21.     MemoryModel = ( tiny, small, compact, medium, large, huge );
  22.  
  23. VAR
  24.     MemModel    :MemoryModel;   (* mem model used to compile/link this pgm *)
  25.     DOSVersion  :CARDINAL;      (* DOS version * 100 *)
  26.     PSP         :CARDINAL;      (* paragraph pointer to DOS program prefix *)
  27.     MemTop      :CARDINAL;      (* end of memory (paragraph) *)
  28.     HeapBase    :CARDINAL;      (* start of heap (paragraph) *)
  29.     StackSeg    :CARDINAL;      (* stack segment (paragraph) *)
  30.     StackSize   :CARDINAL;      (* initial SP value          *)
  31.  
  32.     HeapTop     :CARDINAL;      (* end of heap   (paragraph) *)
  33.                                 (* updated by Storage        *)
  34.  
  35.     AX, BX, CX, DX, SI, DI :CARDINAL;
  36.     BP, DS, ES             :CARDINAL;
  37.     FLAGS                  :BITSET;
  38.  
  39. CONST
  40.     carryFlag   = 0;                (* carry flag IN FLAGS *)
  41.     zeroFlag    = 6;                (* zero flag IN FLAGS *)
  42.  
  43.  
  44. PROCEDURE GetArg( VAR arg: ARRAY OF CHAR; VAR length :CARDINAL );
  45. (*
  46.     returns the next argument in the command line.
  47.  
  48.     1. spaces separate arguments.
  49.     2. / starts a new argument (option).
  50.     3. to override the above, an argument may be quoted (Modula-2
  51.        string).
  52.  
  53.     Ex: COMMAND arg1 'arg 2' /option "command's last arg"
  54. *)
  55.  
  56. PROCEDURE GetEnv( var :ARRAY OF CHAR; VAR val :ARRAY OF CHAR );
  57. (*
  58.     loads val with the value of the environment variable var.
  59.     val will be loaded with the null string if var is not found.
  60. *)
  61.  
  62. PROCEDURE Trap( intno :CARDINAL );
  63. (*
  64.     loads the 8088 registers with the contents of AX..DI
  65.     and then generates the software interrupt specified.
  66.  
  67.     On return from the interrupt, the registers are saved
  68.     in AX..DI. The processor flags are stored in FLAGS.
  69. *)
  70.  
  71. PROCEDURE XTrap( intno :CARDINAL );
  72. (*
  73.     loads the 8088 registers with the contents of AX..ES
  74.     and then generates the software interrupt specified.
  75.  
  76.     On return from the interrupt, the registers are saved
  77.     in AX..ES. The processor flags are stored in FLAGS.
  78. *)
  79.  
  80. PROCEDURE Move( src :ADDRESS; dest :ADDRESS; size :CARDINAL );
  81. (*
  82.     Move size bytes from src to dest.
  83.  
  84.     IF FLAT(src) > FLAT(dest) THEN
  85.         move from low to high address
  86.     ELSE
  87.         move from high to low address
  88.     END
  89. *)
  90.  
  91. PROCEDURE TermProcedure( p :PROC );
  92. (*
  93.     installs a procedure to be executed when the program
  94.     terminates.
  95.  
  96.     Up to 20 termination procedures may be installed.
  97. *)
  98.  
  99. PROCEDURE Terminate( exitStatus :CARDINAL );
  100. (*
  101.     terminates execution, sets the DOS errorlevel to exitStatus
  102. *)
  103.  
  104. PROCEDURE GetVector( IntNum :CARDINAL; VAR ISR :ADDRESS );
  105. (*
  106.     loads in ISR the value of the interrupt vector IntNum
  107. *)
  108.  
  109. PROCEDURE SetVector( IntNum :CARDINAL; ISR :PROC );
  110. (*
  111.     installs ISR to be executed when interrupt IntNum occurs.
  112.     the address loaded in the interrupt vector is that of the
  113.     start of the procedure ISR, skipping the compiler generated
  114.     entry code.
  115.  
  116.     ISR must be compiled with stack checking disabled ($S-).
  117. *)
  118.  
  119. PROCEDURE ResetVector( IntNum :CARDINAL; ISR :ADDRESS );
  120. (*
  121.     loads the interrupt vector IntNum with the value in ISR
  122. *)
  123.  
  124.  
  125. TYPE
  126.     ErrorProc   = PROCEDURE( CARDINAL, ADDRESS );
  127. (*
  128.     A user error handling procedure is passed, in case of a runtime
  129.     error, the runtime error number and the address of the error
  130.     location.
  131.  
  132.     For a list of current runtime error numbers, please consult the
  133.     system's documentation.
  134.  
  135.     The error address can be related to an address in the MAP file
  136.     produced by DBG2MAP by adjusting the segment part thus:
  137.  
  138.         a.SEG := a.SEG - (PSP + 10H);
  139.  
  140.     If the user error handling procedure returns, default error
  141.     processing will take place and the program is terminated.
  142.  
  143. *)
  144.  
  145. PROCEDURE InstallRTErrorHandler( errorProc :ErrorProc );
  146. (*
  147.     installs errorProc to be invoked if a runtime error is
  148.     detected.
  149.  
  150.     Up to 10 error procedures may be installed, but only the last
  151.     one installed will be invoked in case of a runtime error.
  152. *)
  153.  
  154. PROCEDURE UninstallRTErrorHandler;
  155. (*
  156.     uninstalls the errorProc installed last.
  157. *)
  158.  
  159.  
  160. END System.